# 开发环境启动脚本
Write-Host "正在启动 onePass SSO 开发服务器..." -ForegroundColor Green

# 检查并创建bin目录
if (!(Test-Path "bin")) {
    New-Item -ItemType Directory -Path "bin" | Out-Null
}

# 编译应用程序
Write-Host "编译应用程序..." -ForegroundColor Yellow
go build -o bin/sso-core ./cmd/sso-core

if ($LASTEXITCODE -ne 0) {
    Write-Host "编译失败!" -ForegroundColor Red
    exit 1
}

Write-Host "编译成功!" -ForegroundColor Green

# 启动应用程序
Write-Host "启动服务器 (端口 8080)..." -ForegroundColor Yellow
Write-Host "按 Ctrl+C 停止服务器" -ForegroundColor Cyan
.\bin\sso-core